perm filename A109.TEX[106,PHY] blob
sn#807811 filedate 1985-11-15 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 \magnification\magstephalf
C00005 ENDMK
C⊗;
\magnification\magstephalf
\input macro.tex
\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space\number\day, \number\year}
\baselineskip 14pt
\rm
\line{\sevenrm a109.tex[106,phy] \today\hfill}
\font\rmn=amr9
{\rmn
{\narrower\smallskip\noindent
Write a program that plots $\sin(x)$ and $\cos(x)$ ($0≤x≤\pi=3.14159$) on a
single graph with~$x$ as the {\it horizontal\/} coordinate. Vertical and
horizontal scales should be $0.05$ per character. Draw the graphs of
$\sin(x)$ and $\cos(x)$ using the characters~`{\tt X}' and~`{\tt O}'
respectively. Fill the region between the graphs
(below one of the graphs and above the other) with
the character~`{\tt /}'. Superimpose the graph on a background grid at
multiples of 0.25, using the characters `{\tt -}', `{\tt |}', and `{\tt +}'
for horizontals, verticals, and crossings respectively.
\smallskip}
{\narrower\smallskip\noindent
To determine where to print the {\tt X} and {\tt O} characters, calculate
the desired line number as a {\tt REAL} expression ~E, using
{\tt ROUND({\rm E})} as the line where the letter is printed.
\smallskip}
{\narrower\smallskip\noindent
The driver of the part of the program that prints characters should look
like this:
\smallskip}
{\obeylines\obeyspaces\let =\ \tt
FOR R:=? TO ? DO
BEGIN
FOR C:=? TO ? DO
?;
WRITELN
END
}
}
\bigskip
\parindent0pt
\copyright 1984 Robert W. Floyd;
First draft March 28, 1984.
\bye